home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
develop
/
libsrc11.arc
/
XGBYTSPI.C
< prev
Wrap
C/C++ Source or Header
|
1989-04-27
|
853b
|
40 lines
/* xgbytspi.c 4.3 */
/*F****************************************************************************
FUNCTION NAME: xgbytspi
ACTION: Reads/writes a byte from the SPI Port.
Returns an integer with the following format:
Bits 15-8 = SPSR register
Bits 7-0 = Data read
PARAMETERS:
byte_value: value to be output to the SPI port.
RETURNS: (int) byte_read: Data plus status read from
the SPI port.
******************************************************************************/
#include <hc11/io.h>
#include <hc11/spi.h>
#include <hc11/directives.h>
SMALL
unsigned xgbytspi(byte_value)
int byte_value;
{
HC11.SPCR |= SPE;
HC11.SPSRDAT.DATAREG = byte_value;
while ((HC11.SPSRDAT.STATUS & SPIF) == 0)
; /* null statement */
return (HC11.SPSRDAT.STATDATA);
} /* end of xgbytspi */